package com.huafv.flyauth.web.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huafv.flyauth.common.dto.SysMenuDto;
import com.huafv.flyauth.web.admin.entity.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
    List<String> selectPermsByUserId(Long id);

    List<SysMenuDto> selectMenuByUsername(String name);

    List<SysMenu> selectAllMenus();

    SysMenu getMenuInfo(Long menu_id);

    int updateMenuInfo(@Param("menu_id") Long menu_id,
                       @Param("updated") LocalDateTime updated,
                       @Param("state") Integer state,
                       @Param("parentId") Long parentId,
                       @Param("type") Integer type,
                       @Param("order") Integer order,
                       @Param("name") String name,
                       @Param("path") String path,
                       @Param("component") String component,
                       @Param("perms") String perms,
                       @Param("icon") String icon);

    void saveMenuInfo(@Param("created") LocalDateTime created,
                      @Param("state") Integer state,
                      @Param("parentId") Long parentId,
                      @Param("type") Integer type,
                      @Param("order") Integer order,
                      @Param("name") String name,
                      @Param("path") String path,
                      @Param("component") String component,
                      @Param("perms") String perms,
                      @Param("icon") String icon);
}
